import {  put, takeEvery } from 'redux-saga/effects'
import {GET_LIST} from './actionTypes'
import {initData} from './action'
import axios from 'axios'

function* getList() {
    try {
       const res = yield axios.get('https://www.easy-mock.com/mock/5bc0699fa6a4301649d22e4f/react.mock/react');
       const action=initData(res.data.name)
       yield put(action);
    } catch (e) {
      console.log('出错了')
    }
} 

function* mySaga() {
    yield takeEvery(GET_LIST, getList);
}

export default mySaga;

 